package com.platform.api.film.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.api.film.dao.FilmCategoryMapper;
import com.platform.api.film.model.FilmCategory;
import com.platform.api.film.service.FilmCategoryService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author guoyunfei on 2023/9/2 20:21
 * @className FilmCategoryServiceImpl
 * @description TODO
 * @Version 1.0
 */
@Service
public class FilmCategoryServiceImpl extends ServiceImpl<FilmCategoryMapper, FilmCategory> implements FilmCategoryService {

    @Override
    public List<FilmCategory> listAll() {
        List<FilmCategory> filmCategories = baseMapper.selectList(new LambdaQueryWrapper<FilmCategory>()
                .select(FilmCategory::getId, FilmCategory::getName)
                .eq(FilmCategory::getDelFlag, 0)
                .orderByDesc(FilmCategory::getId));
        return filmCategories;
    }
}
